<template>
  <el-checkbox
      border
      v-if="field.not_null"
      v-model="value"
      :disabled="disabled"
      style="width: 100%"
  >
    {{ value ? '是' : '否' }}
  </el-checkbox>

  <el-select
      v-else
      v-model="value"
      :disabled="disabled"
      clearable
      :teleported="false"
      style="width: 100%"
      :value-on-clear="null"
  >
    <el-option :value="true" label="是"></el-option>
    <el-option :value="false" label="否"></el-option>
  </el-select>

</template>

<script setup lang="ts">
import {computed} from "vue";
import type {MetaField} from "../../../types/cell.types";

const props = defineProps<{
  modelValue: any,
  disabled: boolean,
  field: MetaField
}>();

const emit = defineEmits(['update:modelValue'])

const value = computed({
  get: () => props.modelValue,
  set: (v) => emit('update:modelValue', v)
})
</script>

<style scoped>

</style>